package org.oneblog.query;

import java.io.Serializable;

public class AbstractQuery implements Serializable {
    
    private static final long serialVersionUID = 876049671114519295L;
    
    private int pageNo = 1;
    private int pageSize = 20;
    
    public AbstractQuery() {
        
    }
    public int getPageNo() {
        return pageNo;
    }
    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }
    public int getPageSize() {
        return pageSize;
    }
    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }
    public int getFirst() {
        return pageNo > 0 ? (pageNo - 1) * getMax() : 0;
    }
    public int getMax() {
        return pageSize > 0 && pageSize < 1000 ? pageSize : 20;
    }
}
